package cn.lzy.demo;

import cn.lzy.demo.entity.User;
import org.springframework.beans.factory.support.StaticListableBeanFactory;

/**
 * @Description StaticListableBeanFactory 容器的用法
 * @Author lzy
 * @Date 2024/3/8 14:57
 * @Version
 **/
public class StaticListableFactoryBeanDemo {

    public static void main(String[] args) {
        StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
        User user = new User();
        user.setName("Lzy");
        user.setAddress("广东省");
        beanFactory.addBean("user2", user);

        User bean = beanFactory.getBean("user2", User.class);
        System.out.println(bean);
    }
}
